// DlgSetting.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "DlgSetting.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgSetting dialog


CDlgSetting::CDlgSetting(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSetting::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgSetting)
	m_uiBarCodeLength = 0;
	m_uiQuenLength = 0;
	m_uiAlarmTime = 0;
	m_bIsLog = FALSE;
	//}}AFX_DATA_INIT

	m_uicontent = 0;
}


void CDlgSetting::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgSetting)
	DDX_Control(pDX, IDC_Combo_Content, m_combocontent);
	DDX_Text(pDX, IDC_Edit_BarcodeLength, m_uiBarCodeLength);
	DDX_Text(pDX, IDC_Edit_QuenLength, m_uiQuenLength);
	DDX_Text(pDX, IDC_Edit_AlarmTime, m_uiAlarmTime);
	DDX_Check(pDX, IDC_Check_IsLog, m_bIsLog);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgSetting, CDialog)
	//{{AFX_MSG_MAP(CDlgSetting)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSetting message handlers

BOOL CDlgSetting::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_combocontent.SetCurSel(m_uicontent);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CDlgSetting::GetControlState(UINT &barcodelength, UINT &quenlength, UINT &content, UINT &alarmtime, UINT &IsLogFile)
{
	barcodelength = m_uiBarCodeLength;
	quenlength = m_uiQuenLength;
	content = m_uicontent;

	alarmtime = m_uiAlarmTime;
	IsLogFile = (UINT)m_bIsLog;
}

void CDlgSetting::SetControlState(UINT barcodelength, UINT quenlength, UINT content, UINT alarmtime, UINT IsLogFile)
{
	m_uiBarCodeLength = barcodelength;
	m_uiQuenLength = quenlength;
	m_uicontent = content;

	m_uiAlarmTime = alarmtime;
	m_bIsLog = IsLogFile;
}

void CDlgSetting::OnOK() 
{
	UpdateData();
	m_uicontent = m_combocontent.GetCurSel();
	
	CDialog::OnOK();
}
